package zjh_20230313;

import java.util.LinkedList;
import java.util.Scanner;

public class Demo01 {
    public static void main(String[] args) {
        LinkedList list = new LinkedList();
        for (int i = 0; i < 5; i++) {
            list.add(i);
        }
        System.out.println(list);

        list.remove(list.size() - 1);
        list.remove(0);
        System.out.println(list);

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入添加的第一个元素：");
        list.add(0,scanner.next());
        System.out.println("请输入添加的第二个元素：");
        list.add(list.size(),scanner.next());
        System.out.println(list);
    }


}
